/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package biblioteca.servicio;

import biblioteca.dao.PrestamoDao;
import biblioteca.persistencia.Prestamo;
import com.google.appengine.api.datastore.Key;
import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;

/**
 *
 * @author hell
 */
public class PrestamoServicioImpl implements PrestamoSercicio {

    private PrestamoDao prestamoDao;


    @Autowired
    @Required
    public void setPrestamosDao(final PrestamoDao sancionDao) {
              this.prestamoDao = sancionDao;
    }

    @Override
    public void create(Prestamo prestamo) {
          prestamoDao.insert(prestamo);
    }

    @Override
    public void borrar(Prestamo prestamo) {
        prestamoDao.remove(prestamo);
    }

    @Override
    public int countSanciones(Key idSancion) {
        return prestamoDao.countAll(Prestamo.class);
    }

    @Override
    public Collection<Prestamo> getPrestamos(String dni) {
       return prestamoDao.getAll(Prestamo.class);
    }
    

}
